<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/admin.css" source="widget" />
<script src="${ctx}/js/controllers/mall/adinfo/AdInfoEditController.js"
	type="text/javascript"></script>
<style>
select {
	padding-left: 18px;
	font-size: 14px;
	border-radius: 10px;
	width: 54%;
	margin-top: 4px;
	background-image: none;
	border: 1px solid #E5E5E5;
	color: #8b8787;
}
</style>
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<div class="panel panel-default">
		<div class="editTitle">
			<div style="height: 41px; width: 190px; float: left;">
				<img style="float: left; margin-left: 37px; margin-top: 9.5px;"
					src="${ctx}/images/new_edit.png" />
				<c:if test="${type == 1 }">
					<h4>新增广告位信息</h4>
				</c:if>
				<c:if test="${type == 2 }">
					<h4>编辑广告位信息</h4>
				</c:if>
			</div>
			<div>
				<a style="float: right; margin-right: 20px; margin-top: -2px;"
					title="关闭" onclick="cancel();"><img
					src="${ctx}/images/new_close.png" /></a>
			</div>
		</div>
		<div id="form" class="form" style="min-height: 350px;">
			<div class="itemEditMap" style="height: 100px">
				<input id="imageLogo" type="hidden" value="${adInfo.img }">
				<span class="col-sm-1 editlableEditMap"
					style="height: 100px; line-height: 100px;">广告图片：</span>
				<div class="flEditMap" style="height: 100px;">

					<c:if test="${adInfo.img == null || adInfo.img == ''}">
						<img id="preview3"
							style="width: 70px; height: 70px; float: left; margin-top: 10px;"
							title="快上传封面图片吧" src="${ctx}/images/table/ad_default.png" />
					</c:if>
					<c:if test="${adInfo.img != null && adInfo.img != ''}">
						<img id="preview3"
							style="width: 70px; height: 70px; float: left; margin-top: 10px;"
							src="${sessionScope.image_logo}${adInfo.img}" />
					</c:if>
					<div class="mtjxsa" style="float: left; margin: 10px 20px;">
						<p style="text-align: left; font-size: 12px;" id="imageBtn">
							<input type="hidden" name="imageLogoUrl" id="imageLogoUrl" value="${adInfo.img}" /> 
							<label class="lbl" style="width: 400px; height: 15px;">提示：只能上传.jpg, .png的图片格式,照片文件大小最大为10MB</label><br/>
							<label id="adCategory" class="lbl" style="width: 400px; height: 15px;">请选择广告位类型后，按照提示的长宽上传合适的图片！</label>
						</p>
						<div>
							<div class="fl">
								<button
									style="width: 100px; height: 25px; margin-top: 5px; background-color: #593505; color: #fff; border: 0px; line-height: 25px;"
									class="acblu tctpsc">上传广告图片</button>
							</div>
						</div>
					</div>
					<%@include file="/views/common/uploader/picture.jsp"%>
				</div>
			</div>
			<div class="itemEdit">
				<input id="infoadCategoryid" type="hidden"
					value="${adInfo.adCategoryId }"> <label
					class="col-sm-1 editlableEdit">广告位类型：</label>
				<div class="flEdit">
					<c:if test="${type == 1 }">
						<select id="adCategoryid" class="controlEdit" onblur="checkAdCategoryType()" style="height: 29px; width: 130px" required>
							<option value="">--类型--</option>
							<c:forEach items="${adCategorys}" var="item" varStatus="cStatus">
								<option value="${item.id}"
									<c:if test="${item.id == adCategoryId}">selected="selected"</c:if>>${item.name}</option>
							</c:forEach>
						</select>
					</c:if>
					<c:if test="${type == 2 }">
						<input id="adCategoryid" value="${adInfo.adCategoryId}" type="hidden">
						<input id="adCategoryName" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="${adInfo.adCategoryName}">
					</c:if>
					<em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<label class="col-sm-1 editlableEdit">标题：</label>
				<div class="flEdit">
					<input id="adInfoId" type="hidden" value="${adInfo.id}"> 
					<input class="controlEdit" style="width: 80%;" id="title" type="text" onblur="checkTitle()" value="${adInfo.title}" class="text" maxlength="50"
						placeholder="请输入标题（最多50字）" <c:if test="${type == 2 }">readonly="readonly" </c:if>> <em class="emStyle">*</em>
						
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">开始时间：</span>
				<div class="flEdit">
					<input class="controlEdit" id="beginTime" type="text"
						maxlength="11" style="width: 14%" class="input-sm"
						onblur="checkBeginTime()"
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'endTime\')}'})"
						value="${adInfo.beginTime}" placeholder="开始时间" <c:if test="${type == 2 }">disabled="disabled" </c:if>> <em
						class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">结束时间：</span>
				<div class="flEdit">
					<input class="controlEdit" id="endTime" type="text" maxlength="11"
						style="width: 14%" class="input-sm" onblur="checkEndTime()"
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'beginTime\')}',startDate:'#F{$dp.$D(\'beginTime\',{d:+1})}'})"
						value="${adInfo.endTime}" placeholder="结束时间" <c:if test="${type == 2 }">disabled="disabled" </c:if>> <em
						class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">对象类型：</span>
				<div class="flEdit">
					<c:if test="${type == 1 }">
						<select id="objType" class="controlEdit" onblur="checkObjType()"
							style="height: 29px; width: 130px" onchange="selectChange()" >
							<option value="" selected="selected">请选择对象类型</option>
							<option value="1">店铺</option>
							<option value="2">商品</option>
							<option value="3">特殊网页</option>
						</select>
						<select id="shopsCheck" onblur="checkShops()" class="controlEdit" style="height: 29px; width: 130px">
	                        <option value=''>请选择店铺</option>
	                        <c:forEach items="${shopInfos}" var="item" varStatus="cStatus">
								<option value="${item.id}">${item.name}</option>
					        </c:forEach>
	                    </select>
						<select id="goodsCheck" onblur="checkGoods()" class="controlEdit" style="height: 29px; width: 130px">
	                        <option value=''>请选择商品</option>
	                    </select>
	                    <input id="webUrlCheck" class="controlEdit" type="text" maxlength="50" onblur="checkURL()" value="${adInfo.url}" style="height: 29px; width: 200px" placeholder="请输入网址"> 
					</c:if>
					<c:if test="${type == 2 }">
						<input id="objType" value="${adInfo.objType}" type="hidden">
						<c:if test="${adInfo.objType == 1 }">
							<input id="objTypeVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="店铺">
							<c:forEach items="${shopInfos}" var="item" varStatus="cStatus">
								<c:if test="${adInfo.objId == item.id}">
									<input id="shopsCheck" value="${adInfo.objId}" type="hidden">
									<input id="shopsCheckVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="${item.name}">
								</c:if>
					        </c:forEach>
						</c:if>
						<c:if test="${adInfo.objType == 2 }">
							<input id="objTypeVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="店铺">
							<c:forEach items="${shopInfos}" var="item" varStatus="cStatus">
								<c:if test="${adInfo.objId == item.id}">
									<input id="shopsCheck" value="${adInfo.objId}" type="hidden">
									<input id="shopsCheckVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="${item.name}">
								</c:if>
					        </c:forEach>
							<input id="objTypeVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="商品">
							<c:forEach items="${goodsInfos}" var="item" varStatus="cStatus">
								<c:if test="${adInfo.objId == item.id}">
									<input id="goodsCheck" value="${adInfo.objId}" type="hidden">
									<input id="goodsCheckVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="${item.name}">
								</c:if>
					        </c:forEach>
						</c:if>
						<c:if test="${adInfo.objType == 3 }">
							<input id="objTypeVal" class="controlEdit" style="height: 29px;width: 14%" type="text" readonly="readonly" value="特殊网页">
							<input class="controlEdit" id="webUrlCheck" type="text" maxlength="50" onblur="checkURL()" value="${adInfo.url}" style="height: 29px; width: 200px" placeholder="请输入网址"> 
						</c:if>
					</c:if>
					<em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">备注说明：</span>
				<div class="flEdit">
					<input class="controlEdit" style="width: 80%;" id="remark" type="text" maxlength="200"
						value="${adInfo.remark}" placeholder="请输入相关备注说明（最多200字）" >
				</div>
			</div>
			<c:if test="${type == 2 }">
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">发布账户：</span>
					<div class="flEdit">
						<input class="controlEdit" id="userAccount" style="width: 14%"
							type="text" value="${adInfo.userAccount}" readonly="readonly">
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">发布账户类型：</span>
					<div class="flEdit">
						<c:if test="${adInfo.userAccountType == 1 }">
							<input class="controlEdit" type="text" value="平台"
								style="width: 14%" readonly="readonly">
						</c:if>
					</div>
				</div>
			</c:if>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">排序：</span>
				<div class="flEdit">
					<input class="editform-control" id="sort" onblur="checkSort();"
						type="number" maxlength="11" style="width: 60px;"
						value="${adInfo.sort == null ? 1 : adInfo.sort}">
						<em class="emStyle">*</em>
				</div>
			</div>

			<div class="foot">
				<button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
				<button class="buttonEdit" onclick="saveAdInfo();">保&nbsp;&nbsp;存</button>
			</div>
		</div>
		<%@include file="/views/common/footer.jsp"%>
	</div>
</section>
<script type="text/javascript">
	var ctx = '${ctx}';
	setCtx(ctx);
</script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
